<?php 
	require_once('settings.php');
	require_once('classes/db.php');
	require_once('classes/auth.php');
	require_once('classes/functions.php');

	$adminspre_query = mysql_query("SELECT * FROM sm_admins_pre WHERE forumid='$forumuserid'") or die(mysql_error());  
	$adminspre_array = mysql_fetch_assoc($adminspre_query);

	$usersteamid_tmp = $adminspre_array['identity'];
	$usersteamid = mysql_real_escape_string($usersteamid_tmp);

	$useradminid_tmp = $adminspre_array['id'];
	$useradminid = mysql_real_escape_string($useradminid_tmp);

	$useradminname_tmp = $adminspre_array['name'];
	$useradminname = mysql_real_escape_string($useradminname_tmp);

	$steamidentryquery = mysql_query("SELECT identity FROM sm_admins_pre WHERE forumid='$forumuserid'");
	$steam_entered_bool = mysql_num_rows($steamidentryquery);
	if($steam_entered_bool == 1) {
		$steam_id_entered = true;
	} else {
		$steam_id_entered = false;
	}

	$steamidsearch = mysql_query("SELECT identity FROM sm_admins WHERE identity='$usersteamid'");
	$steam_id_verified_bool = mysql_num_rows($steamidsearch);
	if($steam_id_verified_bool == 1) {
		$steam_id_verified = true;
	} else {
		$steam_id_verified = false;
	}

	$curradminidq = mysql_query("SELECT id FROM sm_admins WHERE identity='$usersteamid'");
	$curradminida = mysql_fetch_array($curradminidq);
	$curradminid = $curradminida['id'];
	$curradminbool = mysql_num_rows($curradminidq);

	if($curradminbool == 0) {
		$userisadmin = false;
	} else {
		$userisadmin = true;
	}


	$banidget = $_GET['banid'];
	$banid = mysql_real_escape_string($banidget);
	$bandetailsquery = mysql_query("SELECT * FROM mysql_bans WHERE id='$banid'");
	$bandetailsrow = mysql_fetch_assoc($bandetailsquery);
	if (empty($bandetailsrow['banned_by_id'])) {
		$consoleban = true;
	} else {
		$consoleban = false;
	}

	if($steam_id_verified_bool == 1) {
		$currsbbidq = mysql_query("SELECT id FROM sm_admins WHERE identity='$usersteamid'");
		$currsbbida = mysql_fetch_assoc($currsbbidq);
		$currsbbid = $currsbbida['id'];
	}

	$bansubmissionsq = mysql_query("SELECT * FROM mysql_bans_submission ORDER BY id DESC $max")/*  or die(mysql_error()) */; 
	$bansubmissionsbool = mysql_num_rows($bansubmissionsq);
	if ($bansubmissionsbool >= 1) {
		$newbansubmissions = true;
	} else {
		$newbansubmissions = false;
	}

	$banint = $bandetailsrow['ban_length'];
	switch ($banint) {
		case 0:
			$bantime = "Permanent";
			break;
		case 1:
			$bantime = "1 Minute";
			break;
		case ($banint < 60):
			$bantime = "Less than 1 hour";
			break;
		case 60:
			$bantime = "1 Hour";
			break;
		case (($banint > 60) && ($banint < 720)):
			$bantime = "1-12 Hours";
			break;
		case 720:
			$bantime = "12 Hours";
			break;
		case (($banint > 720) && ($banint < 1440)):
			$bantime = "12-24 Hours";
			break;
		case 1440:
			$bantime = "1 Day";
			break;
		case (($banint > 1440) && ($banint < 10080)):
			$bantime = "1-7 Days";
			break;
		case 10080:
			$bantime = "1 Week";
			break;
		case (($banint > 10080) && ($banint < 20160)):
			$bantime = "1-2 Weeks";
			break;
		case 20160:
			$bantime = "2 Weeks";
			break;
		case (($banint > 20160) && ($banint < 43200)):
			$bantime = "2-4 Weeks";
			break;
		case 43200:
			$bantime = "1 Month";
			break;
		case (($banint > 43200) && ($banint < 86400)):
			$bantime = "1-2 Months";
			break;
		case 86400:
			$bantime = "2 Months";
			break;
		case (($banint > 86400) && ($banint < 259200)):
			$bantime = "2-6 Months";
			break;
		case 259200:
			$bantime = "6 Months";
			break;
		case (($banint > 259200) && ($banint < 518400)):
			$bantime = "6-12 Months";
			break;
		case 518400:
			$bantime = "1 Year";
			break;
		case ($banint > 43200):
			$bantime = "Over 1 Year";
			break;
	}

?>